package com.wgj.android.ui.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.widget.FrameLayout;

import com.jiaai.xui.base.XActivity;
import com.jiaai.xui.view.widget.XTopbarView;
import com.jiaai.xui.view.widget.tablayout.CommonTabLayout;
import com.jiaai.xui.view.widget.tablayout.TabEntity;
import com.jiaai.xui.view.widget.tablayout.listener.CustomDrawableTabEntity;
import com.wgj.android.R;
import com.wgj.android.fragment.CardFragment;
import com.wgj.android.fragment.TemplateFragment;
import com.wgj.android.http.WGJAPI;
import com.wgj.android.utils.CacheUtils;
import com.wgj.android.web.XXXWebFragment;
import com.wgj.android.web.entity.WebConfig;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ShareCardActivity extends XActivity{
    @BindView(R.id.contentView)
    FrameLayout contentView;
    @BindView(R.id.tablayout)
    CommonTabLayout tablayout;

    private ArrayList<Fragment> mFragments = new ArrayList<>();
    private ArrayList<CustomDrawableTabEntity> mTabEntities = new ArrayList<>();

    @Override
    public int getLayoutId() {
        return R.layout.activity_share_card;
    }

    @Override
    public void initData(Bundle bundle) {
        ButterKnife.bind(this);
    }

    @Override
    public void initView() {

        mFragments.add(new CardFragment());

       /* XXXWebFragment cardcaseFragment =new XXXWebFragment();
        Bundle bundle = new Bundle();
        bundle.putString("url",WGJAPI.WEB_URL+"/card/index.html#/index/cardClip?mId="+ CacheUtils.getMember().getM_id());
        cardcaseFragment.setArguments(bundle);
        mFragments.add(cardcaseFragment);*/

        mFragments.add(new TemplateFragment());

       /* XXXWebFragment teamworkFragment =new XXXWebFragment();
        Bundle bundle1 = new Bundle();
        bundle1.putString("url",WGJAPI.WEB_URL+"/card/index.html#/index/cardMarket?mId="+ CacheUtils.getMember().getM_id());
        teamworkFragment.setArguments(bundle1);
        mFragments.add(teamworkFragment);*/

       /* XXXWebFragment myCardFragment = new XXXWebFragment();
        Bundle bundle2 = new Bundle();
        //bundle2.putString("url", WGJAPI.WEB_URL + "/card/index.html#/index/personal?mId=" + CacheUtils.getMember().getM_id());
        bundle2.putString("url",WGJAPI.WEB_URL+"/card/index.html#/index/personal?mId="+ CacheUtils.getMember().getM_id());
        myCardFragment.setArguments(bundle2);*/
        mFragments.add(XXXWebFragment.getInstance(new WebConfig(WGJAPI.WEB_URL+"/card/index.html#/index/personal?mId="+ CacheUtils.getMember().getM_id())));
        mTabEntities.add(new TabEntity("首页", getResources().getDrawable(R.mipmap.home), getResources().getDrawable(R.mipmap.home_normal)));
        //mTabEntities.add(new TabEntity("名片夹", getResources().getDrawable(R.mipmap.search), getResources().getDrawable(R.mipmap.search_no)));
        mTabEntities.add(new TabEntity("模板", getResources().getDrawable(R.mipmap.muban), getResources().getDrawable(R.mipmap.muban_no)));
        //mTabEntities.add(new TabEntity("找合作", getResources().getDrawable(R.mipmap.hezuo), getResources().getDrawable(R.mipmap.hezuo_no)));
        mTabEntities.add(new TabEntity("我的", getResources().getDrawable(R.mipmap.my), getResources().getDrawable(R.mipmap.my_normal)));

        tablayout.setDrawbleTabData(mTabEntities, this, R.id.contentView, mFragments);
        tablayout.setCurrentTab(0);

    }

    public CommonTabLayout getTable() {
        return tablayout;
    }

}
